const Utils = require("./Utils.js")

Utils.init()

// 关闭好友协助申请
threads.start(() => {
	while (true) {
		sleep(30 * 1000)
		Utils.findPhotoTap("叉号", 0.8, [1100, 120, 140, 120])
	}
})

let flag = true
const num = 40
let seconds = num
let count = 0
let times = 90

while (flag) {
	sleep(2000)
	if (Utils.findPictureTap("临时挑战")) {
		sleep(1000 * 10)
		if (Utils.findPictureTap("临时挑战")) {
			Utils.stopJB()
		} else Utils.waitTime(seconds)
	} else if (Utils.findPictureTap("胜利")) {
	} else if (Utils.findPictureTap("奖励")) {
		seconds = num
		count++
	} else {
		log("已等待: " + (seconds += 7) + " 秒")
	}
	if (times === count) {
		Utils.stopJB()
	}
	log("已挑战: " + count + " 次")
}
